package com.turing.post.cardmanagement.util;

import java.io.Serializable;
import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 卡种类绑定商圈
 * 
 * @author kangzhe
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "CARDCLASSICBINDDISTRICT")
@IdClass(CardClassicBindDistrict.class)
public class CardClassicBindDistrict implements Serializable {

	private BigInteger cardClassicId; // (UNI,FK) 卡类ID int Not Null
	private BigInteger businessDistrictId;// (UNI,FK) 商圈ID int Not Null

	public CardClassicBindDistrict() {

	}

	@Id
	@Column(name = "CARDCLASSICID")
	public BigInteger getCardClassicId() {
		return cardClassicId;
	}

	public void setCardClassicId(BigInteger cardClassicId) {
		this.cardClassicId = cardClassicId;
	}

	@Id
	@Column(name = "BUSINESSDISTRICTID")
	public BigInteger getBusinessDistrictId() {
		return businessDistrictId;
	}

	public void setBusinessDistrictId(BigInteger businessDistrictId) {
		this.businessDistrictId = businessDistrictId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((getBusinessDistrictId() == null) ? 0
						: getBusinessDistrictId().hashCode());
		result = prime
				* result
				+ ((getCardClassicId() == null) ? 0 : getCardClassicId()
						.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final CardClassicBindDistrict other = (CardClassicBindDistrict) obj;
		if (getBusinessDistrictId() == null) {
			if (other.getBusinessDistrictId() != null)
				return false;
		} else if (!getBusinessDistrictId().equals(
				other.getBusinessDistrictId()))
			return false;
		if (getCardClassicId() == null) {
			if (other.getCardClassicId() != null)
				return false;
		} else if (!getCardClassicId().equals(other.getCardClassicId()))
			return false;
		return true;
	}

}
